package com.qinggeng.project.system.controller;

import com.github.pagehelper.PageInfo;
import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.project.system.domain.*;
import com.qinggeng.project.system.dto.*;
import com.qinggeng.project.system.service.*;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/system/userAccount")
@CrossOrigin
public class UserAccountController {
    @Resource
    private IUserAccountService userAccountService;

    @Resource
    private UserAccountRecordService  userAccountRecordService;

    @Resource
    private UserAccountConsumptionMonthService userAccountConsumptionMonthService;


    @Resource
    private UserAccountConsumptionYearService userAccountConsumptionYearService;

    //账户记录
    @GetMapping
    //@PreAuthorize("@ss.hasPermi('system:userAccount:list')")
    public AjaxResult listAccount(SysUserAccountDTO userAccountDTO){
        List<UserAccount> list=userAccountService.listSysUserAccount(userAccountDTO);
        return AjaxResult.success(new PageInfo(list));
    }


    //流水记录

    @GetMapping("/listAccountRecord")
    //@PreAuthorize("@ss.hasPermi('system:userAccount:list')")
    public AjaxResult listAccountRecord(SysUserAccountRecordDTO dto){
        List<UserAccountRecord> list=userAccountRecordService.listSysUserAccountRecord(dto);
        return AjaxResult.success(new PageInfo(list));
    }


    //月消费记录
    @GetMapping("/listAccountRecordMonth")
    //@PreAuthorize("@ss.hasPermi('system:userAccount:list')")
    public AjaxResult listAccountRecordMonth(SysUserAccountConsumptionMonthDTO dto){
        List<UserAccountConsumptionMonth> list=userAccountConsumptionMonthService.listSysThisMonthUserAccountConsumptionMonth(dto);
        return AjaxResult.success(new PageInfo(list));
    }

    //年消费记录
    @GetMapping("/listAccountRecordYear")
    //@PreAuthorize("@ss.hasPermi('system:userAccount:list')")
    public AjaxResult listAccountRecordYear(SysUserAccountConsumptionYearDTO dto){
        List<UserAccountConsumptionYear> list=userAccountConsumptionYearService.listSysUserAccountConsumptionYear(dto);
        return AjaxResult.success(new PageInfo(list));
    }

}
